-- Sliders_by_Marco.lua

function slide(y)
  back_r, back_g, back_g = get_rgb(0,y)
  for x = 0, bound_x1 - 1 , 1 do
    r, g, b = get_rgb(x + 1, y)
    set_rgb(x, y, r, g, b)
  end
  set_rgb(width - 1, y, back_r, back_g, back_g)
end

rep = Dog_ValueBox("Slider", "Repeat:", 1, 50, 5)
prob = Dog_ValueBox("Slider", "Probability:", 1, 20, 5)

counter = 0
maxcounter = rep * (bound_y1 - bound_y0)
for t = 1, rep, 1 do
  for y = bound_y0, bound_y1, 1 do
    c = math.random(prob)
    if c == 1 then
      slide(y)
    end
    counter = counter + 1
    progress(counter / maxcounter)
  end
  flush()
  Dog_Refresh()
end

--